
import { useAppDispatch, useAppSelector } from '@/hooks/app.hooks'
import { decrement, increment } from "@/slice/counterSlice"
import { Button, Space } from 'antd';


export default function Counter() {
    const count = useAppSelector(state => state.counter.value)
    const dispatch = useAppDispatch()


  return (
    <Space size={"middle"}>
        <Button
          aria-label="Increment value"
          onClick={() => dispatch(increment())}
        >
            增加
        </Button>
        <span>{count}</span>
        <Button
          aria-label="Decrement value"
          onClick={() => dispatch(decrement())}
        >
            减少
        </Button>
        
    </Space>
  )
}
